import random

def gen(nn, start, ending):
	print(nn)
	for i in range(nn):
		for j in range(nn):
			print(random.randint(start, ending), end = ' ')
		print()

def main():
#	print(4)
#	gen(51, 1, 500)	
#	gen(500, 1, 1000000000)
#	gen(1, 1000000000, 1000000000)
#	gen(1, 999999999, 999999999)

	print(1)
	print(500)
	l = list(range(500*500+1))
	l.reverse()
	for i in l:
		if i > 0 : print(i, end = ' ')
		if i % 500 == 1: print()

	
if __name__ == "__main__":
	main()
